//
//  ZhuCeSuccessedAlertView.m
//  FactorySale
//
//  Created by 李 on 2020/1/15.
//  Copyright © 2020 主事丫环. All rights reserved.
//

#import "ZhuCeSuccessedAlertView.h"

@implementation ZhuCeSuccessedAlertView
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self configViewsWithFrame:frame];
    }
    
    return self;
    
}
-(void)configViewsWithFrame:(CGRect)frame
{
    self.frame = frame;

    UIView *backView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KWIDTH, KHEIGHT)];
    backView.backgroundColor = [UIColor colorWithHexString:@"#000000"];
    backView.alpha = 0.5;
    [self addSubview:backView];
    
    
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake((ScreenW-310)/2, 200, 310, 231)];
    imageView.image = [UIImage imageNamed:@"弹窗"];
    imageView.userInteractionEnabled = YES;
    [self addSubview:imageView];
    
    UILabel *titleLab = [[UILabel alloc] init];
           titleLab.text = @"温馨提示";
           titleLab.font =  KFontPingFangSCMedium(16);
           titleLab.textAlignment = NSTextAlignmentCenter;
           titleLab.textColor = [UIColor colorWithHexString:@"#333333"];
           titleLab.numberOfLines = 0;
           [imageView addSubview:titleLab];
           [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
                            make.left.equalTo(imageView.mas_left).mas_offset(20);
               make.right.equalTo(imageView.mas_right).mas_offset(-20);
                            make.top.equalTo(imageView.mas_top).mas_offset(108);
                       make.height.mas_greaterThanOrEqualTo(16);

                        }];
    
        UILabel *contentLab = [[UILabel alloc] init];
              contentLab.text = @"提交成功，请等待审核";
              contentLab.font =  KFontPingFangSCMedium(13);
              contentLab.textAlignment = NSTextAlignmentCenter;
              contentLab.textColor = [UIColor colorWithHexString:@"#999999"];
              contentLab.numberOfLines = 0;
              [imageView addSubview:contentLab];
              [contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
                               make.left.equalTo(imageView.mas_left).mas_offset(20);
                               make.top.equalTo(titleLab.mas_bottom).mas_offset(17);
                  make.right.equalTo(imageView.mas_right).mas_offset(-20);
                          make.width.mas_greaterThanOrEqualTo(200);
                          make.height.mas_greaterThanOrEqualTo(13);

                           }];
    self.contentLab = contentLab;
    
    
   UIButton *sureBtn = [UIButton  buttonWithType:(UIButtonTypeCustom)];
    [sureBtn setBackgroundImage:[UIImage imageNamed:@"注册成功确定"] forState:UIControlStateNormal];

       [sureBtn setTitle:@"确定" forState:(UIControlStateNormal)];
       [sureBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    sureBtn.titleLabel.font = KFontPingFangSCMedium(15);
       [sureBtn addTarget:self action:@selector(sureBtnAction:) forControlEvents:(UIControlEventTouchUpInside)];
    
    [imageView addSubview:sureBtn];

       [sureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
              make.left.equalTo(imageView.mas_left).mas_offset(0);
           make.right.equalTo(imageView.mas_right).mas_offset(0);
            make.bottom.equalTo(imageView.mas_bottom).mas_offset(0);
                                  make.height.mas_equalTo(45);
       }];
    
}
-(void)sureBtnAction:(UIButton *)btn
{
    if (self.sureBtnHandle) {
        self.sureBtnHandle();
    }
}
@end
